//
//  VehicleDetailsVC.m
//  Logistics
//
//  Created by enzhoukeji on 2018/8/8.
//  Copyright © 2018年 puyue.com. All rights reserved.
//

#import "VehicleDetailsVC.h"

@interface VehicleDetailsVC ()
@property (nonatomic,strong) UIView *bigView;
@property (nonatomic,strong) UIView *informationView;
@property (nonatomic,strong) UILabel * titleName;

@end

@implementation VehicleDetailsVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navTitle = @"车辆详情";
    [self.navRightBtn setImage:[UIImage imageNamed:@"Search"] forState:0];
    // Do any additional setup after loading the view.
    [self createUI];
}
-(void)createUI {

    self.bigView = [UIView new];
    self.bigView.backgroundColor = WGColor;
    [self.view addSubview:self.bigView];
    self.informationView = [UIView new];
    self.informationView.backgroundColor = [UIColor whiteColor];
    self.informationView.layer.cornerRadius = 10;
    self.informationView.layer.shadowColor = [UIColor grayColor].CGColor;
    self.informationView.layer.shadowOffset = CGSizeMake(0, 3);
    self.informationView.layer.shadowOpacity = 0.5;
    self.informationView.layer.shadowRadius = 5;
    [self.bigView addSubview:self.informationView];
    
    UIImageView * imageHead = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"touxiangMN"]];
    imageHead.backgroundColor = [UIColor redColor];
    UILabel *nameLabel = [UILabel labelWithSize:[UIFont systemFontOfSize:13] withColor:[UIColor blackColor] withText:@"张三"];
    UILabel *paiZLabel = [UILabel labelWithSize:[UIFont systemFontOfSize:13] withColor:[UIColor blackColor] withText:@"鲁A 12345"];
    [self.informationView addSubview:imageHead];
    [self.informationView addSubview:nameLabel];
    [self.informationView addSubview:paiZLabel];

    [self.bigView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(kMainTopHeight);
        make.height.mas_equalTo(kMainScreen_height - kMainScreen_height/3);
        make.width.mas_equalTo(kMainScreen_width);
    }];
    [self.informationView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(GTFixWidthFlaot(10));
        make.top.mas_equalTo(GTFixHeightFlaot(10));
        make.height.mas_equalTo(kMainScreen_height - kMainScreen_height/2);
        make.width.mas_equalTo(kMainScreen_width - GTFixHeightFlaot(20));
        }];
    [imageHead mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kMainScreen_width/2 -GTFixWidthFlaot(40));
        make.top.mas_equalTo(GTFixHeightFlaot(10));
        make.width.height.mas_equalTo(GTFixWidthFlaot(60));
    }];
    
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kMainScreen_width/2 -GTFixWidthFlaot(60));
        make.top.mas_equalTo(imageHead.mas_bottom).offset(GTFixHeightFlaot(10));
        make.width.mas_equalTo(GTFixWidthFlaot(40));
        make.height.mas_equalTo(GTFixHeightFlaot(15));
    }];
    [paiZLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kMainScreen_width/2 + 10);
        make.top.mas_equalTo(imageHead.mas_bottom).offset(GTFixHeightFlaot(10));
        make.width.mas_equalTo(GTFixWidthFlaot(60));
        make.height.mas_equalTo(GTFixHeightFlaot(15));
    }];
    NSArray *arr = @[@"车长",@"车型",@"已注册时间",@"成交数",@"公里数"];
    NSArray *arrT = @[@"18米",@"厢式",@"150天",@"300",@"1600公里"];
    [self.view layoutIfNeeded];
    for (int i = 0; i < arr.count; i++) {
        UILabel * titleLab = [[UILabel alloc]initWithFrame:CGRectMake(i*((kMainScreen_width - GTFixWidthFlaot(20))/ arr.count), CGRectGetMaxY(nameLabel.frame)+GTFixHeightFlaot(50), (kMainScreen_width - GTFixWidthFlaot(20)) /arr.count, GTFixHeightFlaot(25))];
        titleLab.font = [UIFont systemFontOfSize:13];
        titleLab.textAlignment = NSTextAlignmentCenter;
        titleLab.text = arr[i];
        [self.informationView addSubview:titleLab];
        
        self.titleName = [[UILabel alloc]initWithFrame:CGRectMake(i*((kMainScreen_width - GTFixWidthFlaot(20))/ arrT.count), titleLab.bottom + 10, (kMainScreen_width - GTFixWidthFlaot(20)) /arrT.count, GTFixHeightFlaot(25))];
        self.titleName.textColor = [UIColor grayColor];
        self.titleName.font = [UIFont systemFontOfSize:12];
        self.titleName.textAlignment = NSTextAlignmentCenter;
        self.titleName.text = arrT[i];
        [self.informationView addSubview:self.titleName];
    }
    UIButton * button = [UIButton buttonWithTitle:@"联系车主" withImageName:nil withBGColor:[UIColor grayColor] Withlayer:NO];
    button.titleLabel.font = [UIFont systemFontOfSize:13];
    button.layer.cornerRadius = 6.0;
    button.backgroundColor = [UIColor colorWithRed:106/255.0 green:181/255.0 blue:231/255.0 alpha:1];
    [self.informationView addSubview:button];
    
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kMainScreen_width/2 -GTFixWidthFlaot(45));
        make.height.equalTo(@(GTFixHeightFlaot(20)));
        make.bottom.equalTo(@(GTFixHeightFlaot(-10)));
        make.width.equalTo(@(GTFixWidthFlaot(70)));
    }];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
